/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ventasimple.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "pu_tipo")
public class TipoPublicacion implements Serializable{ 
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)    
    @Column(name = "ID")
    private Integer id;
    
    @Column(name = "DESCRIPCION", length = 80)
    private String descripcion;    
        
    @Column(name = "ACTIVA", length = 1)    
    private String activa;
    
    @Column(name = "PATH_IMAGEN", length = 255)
    private String pathImagen;    
    
    @OneToMany(mappedBy = "tipoPublicacion", cascade = CascadeType.ALL, fetch = FetchType.LAZY )
//    @OrderColumn(name = "orden")   
    List<TipoCaracteristica> caracteristicas;
    
    /**    
    @OneToMany(mappedBy = "tipoPublicacion", cascade = CascadeType.ALL, fetch = FetchType.LAZY )
//    @OrderColumn(name = "orden")   
    List<Marca> marcas;
    
    @OneToMany(mappedBy = "tipoPublicacion", cascade = CascadeType.ALL, fetch = FetchType.LAZY )
//    @OrderColumn(name = "orden")   
    List<Segmento> segmento;
    */
    
    
    
    
    public TipoPublicacion() {
    }

    public TipoPublicacion(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public List<TipoCaracteristica> getCaracteristicas() {
        return caracteristicas;
    }

    public void setCaracteristicas(List<TipoCaracteristica> caracteristica) {
        this.caracteristicas = caracteristica;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }
    
    public String getActiva() {
        return activa;
    }

    public void setActiva(String activa) {
        this.activa = activa;
    }

    public String getPathImagen() {
        return pathImagen;
    }

    public void setPathImagen(String pathImagen) {
        this.pathImagen = pathImagen;
    }
    
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 47 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TipoPublicacion other = (TipoPublicacion) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "TipoPublicacion{" + "id=" + id + '}';
    }
    
}
